1. Field of the Invention
The present invention relates to encoding and decoding techniques of image data.
2. Description of the Related Art
Conventionally, a technique that segments an input image into blocks each having a predetermined size, and applying encoding to each segmented block image using orthogonal transformation is known. The encoding using orthogonal transformation is an effective compression method for a natural image. However, the encoding using orthogonal transformation cannot obtain a satisfactory result for an image including a character or line draw image since it causes mosquito noise and block distortions due to loss of high frequency components of an image.
In order to solve such a problem, intra-block 2-color processing has been proposed. In this processing, in an image where a resolution is more important than tonality such as an image including a character or line draw image, the resolution is maintained by approximating pixels in each block image by 2 colors. Japanese Patent Laid-Open No. 05-056282 is known as a technique that executes this 2-color processing. In 2 gray-level block approximation encoding described in this reference, pixels in a block image are considered as an 2-color image, and identification information is generated to identify each pixel as one of these 2 colors. Then, the identification information and 2-color pixel values are packed, thereby attaining encoding processing. For example, when a block size is 8×8 pixels, and image data of that block is encoded by the 2-color processing, data of all 64 bits are stored as identification information, and 8-bit data for 2 colors are stored as color data, thus outputting fixed-length encoded data of a total of 80 bits. Likewise, when a block size is 16×16 pixels, fixed-length encoded data of a total of 272 bits including 256-bit identification information, and 16-bit (=8 bits×2) color data is output.
However, compressed data is normally stored in an external memory or the like. However, access to this external memory is often made with 4 bytes×N (N is a power of 2). In the aforementioned related art, access efficiency is low. For example, for the 8×8 block size, it is desirable to output fixed-length encoded data of 64 bits. Also, for the 16×16 block size, it is desirable to output fixed-length encoded data of 256 bits.